"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
Object.defineProperty(exports, "__esModule", { value: true });
var common_1 = require("@nestjs/common");
var os = require("os");
var OsService = /** @class */ (function () {
    function OsService() {
    }
    Object.defineProperty(OsService.prototype, "arch", {
        /**
         * 操作系统CPU架构
         */
        get: function () {
            return os.arch();
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(OsService.prototype, "constants", {
        get: function () {
            return os.constants;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(OsService.prototype, "cpus", {
        get: function () {
            return os.cpus();
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(OsService.prototype, "freemem", {
        /**
         * 空闲系统内存的字节数.
         */
        get: function () {
            return os.freemem();
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(OsService.prototype, "homedir", {
        /**
         * 当前用户的home目录
         */
        get: function () {
            return os.homedir();
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(OsService.prototype, "loadavg", {
        /**
         * 平均负载
         */
        get: function () {
            return os.loadavg();
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(OsService.prototype, "networkInterfaces", {
        /**
         * 网络接口
         */
        get: function () {
            return os.networkInterfaces();
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(OsService.prototype, "platform", {
        /**
         * 操作系统平台
         */
        get: function () {
            return os.platform();
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(OsService.prototype, "release", {
        /**
         * 操作系统的发行版.
         */
        get: function () {
            return os.release();
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(OsService.prototype, "tmpdir", {
        /**
         * 临时文件目录
         */
        get: function () {
            return os.tmpdir();
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(OsService.prototype, "totalmem", {
        /**
         * 所有系统内存的字节数
         */
        get: function () {
            return os.totalmem();
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(OsService.prototype, "type", {
        /**
         * 操作系统的名字
         */
        get: function () {
            return os.type();
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(OsService.prototype, "uptime", {
        /**
         * 操作系统的上线时间
         */
        get: function () {
            return os.uptime();
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(OsService.prototype, "userInfo", {
        get: function () {
            return os.userInfo();
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(OsService.prototype, "EOL", {
        get: function () {
            return os.EOL;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(OsService.prototype, "ipv4", {
        get: function () {
            var networkInterfaces = this.networkInterfaces;
            var ipv4 = {
                family: 'IPv4',
                address: '',
                netmask: '',
                mac: '',
                internal: false
            };
            for (var i = 0; i < networkInterfaces.en0.length; i++) {
                var json = networkInterfaces.en0[i];
                if (json.family === 'IPv4') {
                    ipv4 = json;
                }
            }
            return ipv4;
        },
        enumerable: true,
        configurable: true
    });
    OsService = __decorate([
        common_1.Injectable()
    ], OsService);
    return OsService;
}());
exports.OsService = OsService;
